package com.smart.entity;

import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import com.smart.util.DateUtil;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;

@Data
@TableName("ss_attendance")
@EqualsAndHashCode(callSuper=true)
@ApiModel(value="智慧工地-作业记录表")
@NoArgsConstructor
public class SsAttendance extends Model<SsAttendance>{

	private static final long serialVersionUID = 6542991569116928708L;
	
	@TableId
    @ApiModelProperty(value = "主键")
    @TableField(value = "id")
    private Integer id;
    /** 用户id */
    @ApiModelProperty(value = "用户id")
    @TableField(value = "user_id")
    private Integer userId;
    /** 电话 */
    @ApiModelProperty(value = "手机号")
    @TableField(value = "phone")
    private String phone;
    /** 打卡照片 */
    @ApiModelProperty(value = "身份")
    @TableField(value = "identity")
    private String identity;
    /** 创建时间 */
    @ApiModelProperty(value="创建时间(即打卡时间)")
    @TableField(value = "create_time")
    private String createTime;
    /** 创建时间 */
    @ApiModelProperty(value = "创建日期")
    @TableField(value = "create_date")
    private String createDate;
    /** 打卡地址 */
    @ApiModelProperty(value = "打卡地址")
    @TableField(value = "location")
    private String location;
    /** 经度 */
    @ApiModelProperty(value = "经度")
    @TableField(value = "lon")
    private BigDecimal lon;
    /** 维度 */
    @ApiModelProperty(value = "维度")
    @TableField(value = "lat")
    private BigDecimal lat;
    /** 昵称 */
    @ApiModelProperty(value = "昵称")
    @TableField(value = "nick_name")
    private String nickName;
    /** 头像 */
    @ApiModelProperty(value = "头像")
    @TableField(value = "head_url")
    private String headUrl;
    /** 打卡照片 */
    @ApiModelProperty(value = "打卡照片")
    @TableField(value = "picture")
    private String picture;
    /** 车辆编号 */
    @ApiModelProperty(value = "车辆编号")
    @TableField(value = "car_no")
    private String carNo;
    
    public SsAttendance(SysUser details,String localDateTime){
        this.userId = Integer.valueOf(String.valueOf(details.getId()));
        this.nickName = details.getNickName();
        this.phone = details.getUsername();
        this.headUrl = details.getIcon();
        this.createTime = localDateTime;
        this.createDate = DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss");
    }
    
}